#ifndef __MQTT_MAIN_H__
#define __MQTT_MAIN_H__

// 自定义参数
#define tls_mem_alloc   malloc
#define tls_mem_free    free

#define MQTT_DEMO_RECV_BUF_LEN_MAX      1024
#define MQTT_DEMO_READ_TIMEOUT        (-1000)

#define MQTT_DEMO_READ_TIME_SEC         5 // 1 read时长改大，防止重复连接mqtt
#define MQTT_DEMO_READ_TIME_US          0

#define MQTT_DEMO_HMAC_KEY             "ws62e-key"

#define MQTT_DEMO_SERVER_ADDR          "192.168.0.1"             //"192.168.43.18"     //IP    
#define MQTT_DEMO_SERVER_PORT          "1883" //61613               //端口

#define MQTT_DEMO_PUB_TOPIC            "$dev/{device_id}/rpt/up"                        //发布主题：属性上报
#define MQTT_DEMO_SUB_TOPIC            "$dev/{device_id}/cmd/down/#"   // .../down/123"     //订阅主题：平台下发命令
#define MQTT_DEMO_ACK_TOPIC            "$dev/{device_id}/cmd/up/"      // .../up/123"            //响应主题：设备响应命令
#define MQTT_DEMO_WILL_TOPIC           "$dev/{device_id}/will"              
#define MQTT_DEMO_WILL_MSG             "{\"state\":\"offline\"}"        
 
int Mqtt_Start(void);

int Mqtt_Receive(void);

// 线程任务
void mqtt_start_task(void);     // 启动 

void mqtt_stop_task(void);      // 停止

// 发布报文
int publish_radar_data(const char *cmd, const char *value, 
    const char *result, const char *action, char *timestamp); 

int publish_sle_data(const uint8_t *value);
 
#endif //__MQTT_MAIN_H__